'use strict';
$(function () {
    keywords();
})

function add() {
    console.log('努点力一下');
    location.href = './Createedit.html'
}

function keywords(keyword) {
    keyword =keyword || ''
    console.log(keyword);
    aslist(keyword).then(res=>{
        console.log(res);
        render(res.data)
    })
}
function render(data) {
    let tb = $('#rowdate');
        let _db = $('.rowdata');
        _db.remove();
        data.forEach(element => {
            let ht = `
            <tr class="rowdata">
                <td>${element.id}</td>
                <td>${element.biaoti}</td>
                <td>${element.zaiyao}</td>
                <td>${element.neirong}</td>
                <td>${element.fenglei}</td>
                <td>${element.zuozhe}</td>
                <td>
                <input type="button" value="编辑" onclick="update(${element.id})">
                <input type="button" value="删除" onclick="del(${element.id})">
            </td>
            </tr>
            `
            tb.append(ht)
        });
}
